/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * FrmAddCustomer.java
 *
 * Created on Sep 26, 2011, 5:52:55 AM
 */
package piusys.customers;

import java.util.HashMap;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import org.jdesktop.application.Action;
import piusys.kernel.Utilities;

/**
 *
 * @author mrogers
 */
public class FrmAddCustomer extends javax.swing.JInternalFrame
{

    static final Logger logger = Logger.getLogger(FrmAddCustomer.class.getName());
    static String validationText = "";

    /** Creates new form FrmAddCustomer */
    public FrmAddCustomer()
    {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        customerTabbedPane = new javax.swing.JTabbedPane();
        generalPanel = new javax.swing.JPanel();
        lblName = new javax.swing.JLabel();
        txtName = new javax.swing.JTextField();
        lblPriContact = new javax.swing.JLabel();
        txtContact1 = new javax.swing.JTextField();
        lblSecContact = new javax.swing.JLabel();
        txtContact2 = new javax.swing.JTextField();
        cmdCancel = new javax.swing.JButton();
        cmdNext = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();
        addressPanel = new javax.swing.JPanel();
        lblAddress = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        txtAddress = new javax.swing.JTextArea();
        cmdNext2 = new javax.swing.JButton();
        cmdCancel2 = new javax.swing.JButton();
        txtEmail = new javax.swing.JTextField();
        lblEmail = new javax.swing.JLabel();
        telephonePanel = new javax.swing.JPanel();
        lblPrimaryPhone = new javax.swing.JLabel();
        txtPhone1 = new javax.swing.JTextField();
        lblPhone2 = new javax.swing.JLabel();
        txtPhone2 = new javax.swing.JTextField();
        cmdCancel3 = new javax.swing.JButton();
        cmdNext3 = new javax.swing.JButton();
        lblFax = new javax.swing.JLabel();
        txtFax = new javax.swing.JTextField();
        NotesPanel = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        txtNotes = new javax.swing.JTextArea();
        lblNotes = new javax.swing.JLabel();
        cmbSave = new javax.swing.JButton();
        cmdCancel4 = new javax.swing.JButton();

        setClosable(true);
        setIconifiable(true);
        setMaximizable(true);
        setResizable(true);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(piusys.PIUSYSApp.class).getContext().getResourceMap(FrmAddCustomer.class);
        setTitle(resourceMap.getString("Form.title")); // NOI18N
        setFrameIcon(resourceMap.getIcon("Form.frameIcon")); // NOI18N
        setName("Form"); // NOI18N

        customerTabbedPane.setName("customerTabbedPane"); // NOI18N

        generalPanel.setName("generalPanel"); // NOI18N

        lblName.setText(resourceMap.getString("lblName.text")); // NOI18N
        lblName.setName("lblName"); // NOI18N

        txtName.setText(resourceMap.getString("txtName.text")); // NOI18N
        txtName.setName("txtName"); // NOI18N

        lblPriContact.setText(resourceMap.getString("lblPriContact.text")); // NOI18N
        lblPriContact.setName("lblPriContact"); // NOI18N

        txtContact1.setText(resourceMap.getString("txtContact1.text")); // NOI18N
        txtContact1.setName("txtContact1"); // NOI18N

        lblSecContact.setText(resourceMap.getString("lblSecContact.text")); // NOI18N
        lblSecContact.setName("lblSecContact"); // NOI18N

        txtContact2.setText(resourceMap.getString("txtContact2.text")); // NOI18N
        txtContact2.setName("txtContact2"); // NOI18N

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(piusys.PIUSYSApp.class).getContext().getActionMap(FrmAddCustomer.class, this);
        cmdCancel.setAction(actionMap.get("cancel")); // NOI18N
        cmdCancel.setText(resourceMap.getString("cmdCancel.text")); // NOI18N
        cmdCancel.setName("cmdCancel"); // NOI18N

        cmdNext.setAction(actionMap.get("next")); // NOI18N
        cmdNext.setText(resourceMap.getString("cmdNext.text")); // NOI18N
        cmdNext.setName("cmdNext"); // NOI18N

        jButton1.setAction(actionMap.get("resetForm")); // NOI18N
        jButton1.setText(resourceMap.getString("jButton1.text")); // NOI18N
        jButton1.setName("jButton1"); // NOI18N

        javax.swing.GroupLayout generalPanelLayout = new javax.swing.GroupLayout(generalPanel);
        generalPanel.setLayout(generalPanelLayout);
        generalPanelLayout.setHorizontalGroup(
            generalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(generalPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(generalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(generalPanelLayout.createSequentialGroup()
                        .addGroup(generalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblName)
                            .addComponent(lblPriContact)
                            .addComponent(lblSecContact))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(generalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtContact2, javax.swing.GroupLayout.DEFAULT_SIZE, 255, Short.MAX_VALUE)
                            .addComponent(txtContact1, javax.swing.GroupLayout.DEFAULT_SIZE, 255, Short.MAX_VALUE)
                            .addComponent(txtName, javax.swing.GroupLayout.DEFAULT_SIZE, 255, Short.MAX_VALUE)))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, generalPanelLayout.createSequentialGroup()
                        .addComponent(jButton1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 66, Short.MAX_VALUE)
                        .addComponent(cmdNext)
                        .addGap(18, 18, 18)
                        .addComponent(cmdCancel)))
                .addContainerGap())
        );
        generalPanelLayout.setVerticalGroup(
            generalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(generalPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(generalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblName)
                    .addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(generalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblPriContact)
                    .addComponent(txtContact1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(generalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblSecContact)
                    .addComponent(txtContact2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 143, Short.MAX_VALUE)
                .addGroup(generalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cmdCancel)
                    .addComponent(cmdNext)
                    .addComponent(jButton1))
                .addContainerGap())
        );

        customerTabbedPane.addTab(resourceMap.getString("generalPanel.TabConstraints.tabTitle"), resourceMap.getIcon("generalPanel.TabConstraints.tabIcon"), generalPanel); // NOI18N

        addressPanel.setName("addressPanel"); // NOI18N

        lblAddress.setText(resourceMap.getString("lblAddress.text")); // NOI18N
        lblAddress.setName("lblAddress"); // NOI18N

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        txtAddress.setColumns(20);
        txtAddress.setRows(5);
        txtAddress.setName("txtAddress"); // NOI18N
        jScrollPane1.setViewportView(txtAddress);

        cmdNext2.setAction(actionMap.get("next")); // NOI18N
        cmdNext2.setName("cmdNext2"); // NOI18N

        cmdCancel2.setAction(actionMap.get("cancel")); // NOI18N
        cmdCancel2.setName("cmdCancel2"); // NOI18N

        txtEmail.setText(resourceMap.getString("txtEmail.text")); // NOI18N
        txtEmail.setName("txtEmail"); // NOI18N

        lblEmail.setText(resourceMap.getString("lblEmail.text")); // NOI18N
        lblEmail.setName("lblEmail"); // NOI18N

        javax.swing.GroupLayout addressPanelLayout = new javax.swing.GroupLayout(addressPanel);
        addressPanel.setLayout(addressPanelLayout);
        addressPanelLayout.setHorizontalGroup(
            addressPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, addressPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(addressPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(addressPanelLayout.createSequentialGroup()
                        .addComponent(cmdNext2)
                        .addGap(18, 18, 18)
                        .addComponent(cmdCancel2))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, addressPanelLayout.createSequentialGroup()
                        .addGroup(addressPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblAddress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblEmail))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(addressPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtEmail, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 278, Short.MAX_VALUE)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 278, Short.MAX_VALUE))))
                .addContainerGap())
        );
        addressPanelLayout.setVerticalGroup(
            addressPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(addressPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(addressPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblAddress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(addressPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblEmail))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 48, Short.MAX_VALUE)
                .addGroup(addressPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cmdCancel2)
                    .addComponent(cmdNext2))
                .addContainerGap())
        );

        customerTabbedPane.addTab(resourceMap.getString("addressPanel.TabConstraints.tabTitle"), resourceMap.getIcon("addressPanel.TabConstraints.tabIcon"), addressPanel); // NOI18N

        telephonePanel.setName("telephonePanel"); // NOI18N

        lblPrimaryPhone.setText(resourceMap.getString("lblPrimaryPhone.text")); // NOI18N
        lblPrimaryPhone.setName("lblPrimaryPhone"); // NOI18N

        txtPhone1.setText(resourceMap.getString("txtPhone1.text")); // NOI18N
        txtPhone1.setName("txtPhone1"); // NOI18N

        lblPhone2.setText(resourceMap.getString("lblPhone2.text")); // NOI18N
        lblPhone2.setName("lblPhone2"); // NOI18N

        txtPhone2.setText(resourceMap.getString("txtPhone2.text")); // NOI18N
        txtPhone2.setName("txtPhone2"); // NOI18N

        cmdCancel3.setAction(actionMap.get("cancel")); // NOI18N
        cmdCancel3.setName("cmdCancel3"); // NOI18N

        cmdNext3.setAction(actionMap.get("next")); // NOI18N
        cmdNext3.setName("cmdNext3"); // NOI18N

        lblFax.setText(resourceMap.getString("lblFax.text")); // NOI18N
        lblFax.setName("lblFax"); // NOI18N

        txtFax.setText(resourceMap.getString("txtFax.text")); // NOI18N
        txtFax.setName("txtFax"); // NOI18N

        javax.swing.GroupLayout telephonePanelLayout = new javax.swing.GroupLayout(telephonePanel);
        telephonePanel.setLayout(telephonePanelLayout);
        telephonePanelLayout.setHorizontalGroup(
            telephonePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(telephonePanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(telephonePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, telephonePanelLayout.createSequentialGroup()
                        .addComponent(cmdNext3)
                        .addGap(18, 18, 18)
                        .addComponent(cmdCancel3))
                    .addGroup(telephonePanelLayout.createSequentialGroup()
                        .addGroup(telephonePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblPrimaryPhone)
                            .addComponent(lblPhone2)
                            .addComponent(lblFax))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(telephonePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtFax, javax.swing.GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE)
                            .addComponent(txtPhone2, javax.swing.GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE)
                            .addComponent(txtPhone1, javax.swing.GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE))))
                .addContainerGap())
        );
        telephonePanelLayout.setVerticalGroup(
            telephonePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(telephonePanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(telephonePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblPrimaryPhone)
                    .addComponent(txtPhone1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(telephonePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblPhone2)
                    .addComponent(txtPhone2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(telephonePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblFax)
                    .addComponent(txtFax, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 143, Short.MAX_VALUE)
                .addGroup(telephonePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cmdCancel3)
                    .addComponent(cmdNext3))
                .addContainerGap())
        );

        customerTabbedPane.addTab(resourceMap.getString("telephonePanel.TabConstraints.tabTitle"), resourceMap.getIcon("telephonePanel.TabConstraints.tabIcon"), telephonePanel); // NOI18N

        NotesPanel.setName("NotesPanel"); // NOI18N

        jScrollPane2.setName("jScrollPane2"); // NOI18N

        txtNotes.setColumns(20);
        txtNotes.setRows(5);
        txtNotes.setName("txtNotes"); // NOI18N
        jScrollPane2.setViewportView(txtNotes);

        lblNotes.setText(resourceMap.getString("lblNotes.text")); // NOI18N
        lblNotes.setName("lblNotes"); // NOI18N

        cmbSave.setAction(actionMap.get("save")); // NOI18N
        cmbSave.setText(resourceMap.getString("cmbSave.text")); // NOI18N
        cmbSave.setName("cmbSave"); // NOI18N

        cmdCancel4.setAction(actionMap.get("cancel")); // NOI18N
        cmdCancel4.setName("cmdCancel4"); // NOI18N

        javax.swing.GroupLayout NotesPanelLayout = new javax.swing.GroupLayout(NotesPanel);
        NotesPanel.setLayout(NotesPanelLayout);
        NotesPanelLayout.setHorizontalGroup(
            NotesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(NotesPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(NotesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(NotesPanelLayout.createSequentialGroup()
                        .addComponent(lblNotes)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 289, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, NotesPanelLayout.createSequentialGroup()
                        .addComponent(cmbSave)
                        .addGap(18, 18, 18)
                        .addComponent(cmdCancel4)))
                .addContainerGap())
        );
        NotesPanelLayout.setVerticalGroup(
            NotesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(NotesPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(NotesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblNotes)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 204, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(NotesPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cmdCancel4)
                    .addComponent(cmbSave))
                .addContainerGap())
        );

        customerTabbedPane.addTab(resourceMap.getString("NotesPanel.TabConstraints.tabTitle"), resourceMap.getIcon("NotesPanel.TabConstraints.tabIcon"), NotesPanel); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(customerTabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 350, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(customerTabbedPane)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    @Action
    public void cancel()
    {
        Utilities.showCancelScreen(this);
    }

    @Action
    public void next()
    {
       customerTabbedPane.setSelectedIndex(customerTabbedPane.getSelectedIndex() + 1);
    }

    @Action
    public void save()
    {

        if (!passedValidation())
        {
            Utilities.showWarningMessage(rootPane, validationText);
            return;
        }

        HashMap<String, String>  params = new HashMap<String, String>();
        params.put("custName", txtName.getText().trim());
        params.put("custContact1", txtContact1.getText().trim());
        params.put("custContact2", txtContact2.getText().trim());
        params.put("custAddress", txtAddress.getText().trim());
        params.put("custPhone1", txtPhone1.getText().trim());
        params.put("custPhone2", txtPhone2.getText().trim());
        params.put("custEmail", txtEmail.getText().trim());
        params.put("custFax", txtFax.getText().trim());
        params.put("custNotes", txtNotes.getText().trim());
        
        boolean saveCustomer = Customer.saveCustomer(params);

        if (saveCustomer)
        {
            String message = "The customer was successfully added to the system.\n"
                    + "Would you like to add another?";
            int response = Utilities.showConfirmDialog(rootPane, message);
            if (response == JOptionPane.YES_OPTION)
            {
                resetForm();
            }
            else
            {
                this.dispose();
            }
        }
        else
        {
            String message = "An error occurred while trying to save the customer.\n"
                    + "Kindly verify your input and try again.";
            Utilities.showErrorMessage(rootPane, message);
        }

    }

    private boolean passedValidation()
    {
        boolean passed = true;
        validationText = "Kindly correct the issues below before proceeding.\n\n";

        String custName = txtName.getText().trim();
        String custContact1 = txtContact1.getText().trim();
//        String custPhone1 = txtPhone1.getText().trim();
//        String custPhone2 = txtPhone2.getText().trim();
//        String custEmail = txtEmail.getText().trim();
//        String custFax = txtFax.getText().trim();
//        String custNotes = txtNotes.getText().trim();

        if (custName.isEmpty())
        {
            validationText += "Name cannot be empty.\n";
            passed = false;
        }

        if (custContact1.isEmpty())
        {
            validationText += "You must have at least one contact person listed.\n";
            passed = false;
        }

        return passed;
    }

    @Action
    public void resetForm()
    {
        remove(customerTabbedPane);
        initComponents();
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel NotesPanel;
    private javax.swing.JPanel addressPanel;
    private javax.swing.JButton cmbSave;
    private javax.swing.JButton cmdCancel;
    private javax.swing.JButton cmdCancel2;
    private javax.swing.JButton cmdCancel3;
    private javax.swing.JButton cmdCancel4;
    private javax.swing.JButton cmdNext;
    private javax.swing.JButton cmdNext2;
    private javax.swing.JButton cmdNext3;
    private javax.swing.JTabbedPane customerTabbedPane;
    private javax.swing.JPanel generalPanel;
    private javax.swing.JButton jButton1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JLabel lblAddress;
    private javax.swing.JLabel lblEmail;
    private javax.swing.JLabel lblFax;
    private javax.swing.JLabel lblName;
    private javax.swing.JLabel lblNotes;
    private javax.swing.JLabel lblPhone2;
    private javax.swing.JLabel lblPriContact;
    private javax.swing.JLabel lblPrimaryPhone;
    private javax.swing.JLabel lblSecContact;
    private javax.swing.JPanel telephonePanel;
    private javax.swing.JTextArea txtAddress;
    private javax.swing.JTextField txtContact1;
    private javax.swing.JTextField txtContact2;
    private javax.swing.JTextField txtEmail;
    private javax.swing.JTextField txtFax;
    private javax.swing.JTextField txtName;
    private javax.swing.JTextArea txtNotes;
    private javax.swing.JTextField txtPhone1;
    private javax.swing.JTextField txtPhone2;
    // End of variables declaration//GEN-END:variables
}
